package com.zhangws.comman.base

import android.app.Activity
import android.content.Intent
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import androidx.databinding.ViewDataBinding

abstract class BaseActivity<T : ViewDataBinding> : AppCompatActivity() {
    protected lateinit var viewBinding: T

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        viewBinding=getViewDataBinding()
        initView()
        initListener()
        initData()
    }

    abstract fun getViewDataBinding(): T

    abstract fun initView()

    abstract fun initListener()

    abstract fun initData()
}

inline fun <reified T:Activity> Activity.startActivityK() {
    Intent(this,T::class.java).also {
        startActivity(it)
    }
}